import requests


def get_book():
    """ 获取书本的信息 """
    url = 'http://search.dangdang.com/'
    rest = requests.get(url,params={
        'key':'%BA%EC%C2%A5%C3%CE',
        'act':'input'
    })
    print(rest.text)

    #json方式获取数据  rest.json

    #编码
    print(rest.encoding)

    #编码转换
    rest.encoding = 'utf-8'

    #HTTP 状态码
    print(rest.status_code)

if __name__ == '__main__':
        get_book()
